home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / MACVOGL- / HALLOC.C < prev    next >
Text File  |  1992-07-19  |  331b  |  24 lines

  1.  
  2. #include <stdio.h>
  3.  
  4. extern    char    *malloc();
  5.  
  6. /*
  7.  * hallocate
  8.  *
  9.  *    Allocate some memory, barfing if malloc returns NULL.
  10.  */
  11. char *
  12. hallocate(size)
  13.     unsigned    size;
  14. {
  15.     char    *p;
  16.  
  17.     if ((p = (char *)malloc(size)) == (char *)NULL) {
  18.         fprintf(stderr,"hallocate: request for %d bytes returned NULL", size);
  19.         exit(1);
  20.     }
  21.  
  22.     return (p);
  23. }
  24.